home *** CD-ROM | disk | FTP | other *** search
/ Atari Mega Archive 2 / Atari Mega Archive CD - Volume 2.iso / 8bit / cislib_a / brown.apr < prev    next >
Text File  |  1995-04-22  |  7KB  |  172 lines

  1.  
  2. Atari's Small Miracles 
  3. ====================== 
  4.  
  5. by Mark A. Brown - NOVATARI 
  6.  
  7. Welcome back to Atari's Small Miracles, the column written for the slow 
  8. and/or lazy typists in this world.  Here, programs are written short 
  9. enough so anybody can type them in!  There are fun programs, useful 
  10. programs, strange programs, and learning programs.  A little for 
  11. everybody will appear in these pages. 
  12.  
  13. This month's theme is the player/missile graphics features the Atari 
  14. computer can use.  There are four quick programs to help you exploit 
  15. this feature to its fullest! 
  16.  
  17. I won't even try to explain player/missile graphics here, I'll simply 
  18. refer you to the many articles and books written about them.  You won't 
  19. have to look too hard to find some.  Compute! publishing has put out 
  20. literally dozens of good tutorials, ANALOG has put out a few, and so on. 
  21. Almost every magazine that carries Atari will have covered 
  22. player/missile graphics at some point. 
  23.  
  24. PMEDITOR 
  25.  
  26. The first program this month is used to help you create and change 
  27. player/missile graphics.  Type it in, run it, and you can work with any 
  28. shape you want.  The image can be eight pixels wide (obviously) and 
  29. twenty-four lines high. 
  30.  
  31. Use the arrow keys without the control key to move your cursor about 
  32. (i.e. the "-", "+", "=", and "*" keys move you).  Press the space bar to 
  33. turn on the pixel the cursor is sitting on, unless it was already on in 
  34. which case the space bar will flip it off.  Note that the numbers to the 
  35. right of the editing area are the decimal numbers of the data you have 
  36. in the player. 
  37.  
  38. If you don't like the player you are creating, you can strike the CLEAR 
  39. key to erase it and start over.  On the other hand, if you like your 
  40. player, press the ESCape key to quit and a DATA statement will appear 
  41. with the numbers needed to re-create that image.  You can use it in 
  42. PMMOVER, below, or in a program of your own. 
  43.  
  44. 10 GRAPHICS 0:POKE 752,1:DIM A$(2048): 
  45. Z=INT(ADR(A$)/1024)*1024:Z=Z+1024*(Z<A 
  46. DR(A$)):POKE 54279,Z/256:POKE 704,15 
  47. 20 POKE 53277,3:POKE 559,46:POKE 53248 
  48. ,160:A$=CHR$(0):A$(2048)=CHR$(0):A$(2) 
  49. =A$:FOR A=0 TO 23:POSITION 10,A 
  50. 30 ? 0;:NEXT A:S=PEEK(88)+256*PEEK(89) 
  51. :X=1:Y=1:OPEN #1,4,0,"K":POSITION 17,0 
  52. :X=1:Y=0:? "<+-=*>  Moves cursor" 
  53. 40 POSITION 17,1:? "<SPACE> marks pixe 
  54. ls":POSITION 17,2:? "<CLEAR> clears pl 
  55. ayer":POSITION 17,3:? "<ESC>   Ends" 
  56. 50 D=Y*40+X+S:E=PEEK(D):POKE D,E+128:G 
  57. ET #1,B:POKE D,E:X=X+(B=42)-(B=43):Y=Y 
  58. +(B=61)-(B=45):X=X+8*(X=0)-8*(X=9) 
  59. 60 Y=Y-24*(Y=24)+24*(Y=-1):IF B=125 OR 
  60. B=60 THEN RUN 
  61. 70 IF B=27 THEN ? CHR$(125):? "1000 DA 
  62. TA ";:FOR A=0 TO 23:? PEEK(Z+560+A);", 
  63. ";:NEXT A:? CHR$(126):END 
  64. 80 IF B<>32 THEN GOTO 50 
  65. 90 A=Z+560+Y:POKE A,PEEK(A)+(2^(8-X)*( 
  66. E=0))-(2^(8-X)*(E<>0)):POSITION 10,Y:? 
  67.  PEEK(A);"  ";:POKE D,3*(E=0):GOTO 50 
  68.  
  69.  
  70. PMMOVER 
  71.  
  72. This program is largely instructive, and serves little purpose on its 
  73. own.  It simply takes a player, pokes some data into it, then moves it 
  74. around at your joystick's command.  That is all. 
  75.  
  76. What it IS meant to do is show an easy way to vertically move players 
  77. and missiles, through the technique of strings.  This is a fairly simple 
  78. idea that works quite well for small applications.  Study the program 
  79. for a while to fully comprehend it, and don't forget to notice the zeros 
  80. at the beginning and end of the player data.  Those make sure the player 
  81. won't leave a stripe of data behind it.  Replace them with some other 
  82. number to see what I mean. 
  83.  
  84. 10 POKE 82,0:GRAPHICS 19:POKE 752,1:DI 
  85. MA$(2048),P$(24),S(15,2):Z=INT(ADR(A$) 
  86. /1024)*1024:Z=Z+1024*(Z<ADR(A$)) 
  87. 20 POKE 54279,Z/256:POKE 704,15:POKE 5 
  88. 3277,3:POKE 559,46:PS=Z-ADR(A$)+512:A$ 
  89. =CHR$(0):A$(2048)=CHR$(0):A$(2)=A$ 
  90. 30 FOR Z=5 TO 15:READ X,Y:S(Z,1)=X:S(Z 
  91. ,2)=Y:NEXT Z:FOR Z=1 TO 24:READ X:P$(Z 
  92. ,Z)=CHR$(X):NEXT Z:X=128:Y=64 
  93. 40 POKE 53248,X:A$(PS+Y,PS+Y+23)=P$:Z= 
  94. STICK(0):X=X+S(Z,1):Y=Y+S(Z,2):X=X+256 
  95. *(X<0)-256*(X>255) 
  96. 50 Y=Y+128*(Y<0)-128*(Y>127):GOTO 40:D 
  97. ATA 1,1,1,-1,1,0,0,0,-1,1,-1,-1,-1,0,0 
  98. ,0,0,1,0,-1,0,0 
  99. 60 DATA 0,129,66,36,24,24,36,66,129,66 
  100. ,36,24,24,36,66,129,66,36,24,24,36,66, 
  101. 29,0 
  102.  
  103.  
  104. PLAYER5 
  105.  
  106. One of the seldom used features of player/missile graphics is the fifth 
  107. player option.  Simply put, turning on bit 4 of location 623 (GPRIOR) 
  108. turns all the missiles into one color to let them look like a fifth 
  109. player if put together.  PLAYER5 takes care of the tedium of that 
  110. process, i.e. the continous poking of the four missiles to put them next 
  111. to each other.  POKE the horizontal position of the fifth player into 
  112. location 256 and PLAYER5 will automatically move all four missiles to 
  113. their appropriate places to simulate a single player. 
  114.  
  115. Remember that bit 4 of GPRIOR must be on and that the color of the 
  116. player is controlled by location 711. 
  117.  
  118.  
  119. 10 FOR A=256 TO 285:READ B:POKE A,B:NE 
  120. XT A:A=USR(256):POKE 256,128:POKE 5326 
  121. 5,255:POKE 623,16 
  122. 20 DATA 234,104,162,1,160,11,169,6,76, 
  123. 92,228,173,0,1,160,0,153,4,208,24,105, 
  124. 2,200,192,4,144,245,76,95,228 
  125.  
  126.  
  127. VMOVER 
  128.  
  129. And finally a program to suit those of you who couldn't understand 
  130. PMMOVER.  This program is a machine language player/missile graphics 
  131. mover that will take any player and move it any number of bytes up or 
  132. down.  To do this, in your program code the following: 
  133.  
  134. JUNK=USR(ADR(A$),PMADR,DIRNO) 
  135.  
  136. where PMADR is the address of the player you want moved and DIRNO is the 
  137. number of bytes you want your player moved down (to go up, subtract the 
  138. number of lines you want it to go up from 256; for example, to move up 
  139. one line you would put 256-1 or 255 into DIRNO).  And that is all.  Your 
  140. player will be quickly moved to that position.  It doesn't matter if 
  141. it's in single line or double line resolution, VMOVER will adjust 
  142. automatically. 
  143.  
  144. 10 DIM A$(67):FOR A=1 TO 67:READ B:A$( 
  145. A,A)=CHR$(B):NEXT A:DATA 104,104,133,2 
  146. 13,104,133,212,104,104,133,215,160 
  147. 20 DATA 255,173,47,2,41,16,208,2,160,1 
  148. 27,132,214,160,0,132,216,177,212,72,15 
  149. 2,24,101,215,37,214,168,177,212,170 
  150. 30 DATA 104,145,212,196,216,240,5,138, 
  151. 230,217,208,233,200,165,217,197,214,24 
  152. 0,6,230,217,208,218,208,216,96 
  153.  
  154.  
  155. Atari's Small Miracles is a column that needs a regular source of small, 
  156. quality programs, and that source is the readers, you!  If you have any 
  157. good ideas or programs, send them to: 
  158.  
  159. Atari's Small Miracles 
  160. c/o Mark A. Brown 
  161. 7097 Game Lord Drive 
  162. Springfield, VA  22153 
  163.  
  164. If they're less then ten lines and if they're good enough you'll see 
  165. your name here!  See you next month! 
  166.  
  167.  
  168.  
  169. [Reprinted from the April, 1986 issue of CURRENT NOTES: The Newsletter 
  170. for Atari Owners.  For more information on CURRENT NOTES, see the CNOTES 
  171. file in the NEW PRODUCTS section of the Developers SIG.] 
  172. 4444444444444444444444444444444444444444444444444444444444444444444444444444